package edu.towson.cosc603.coffeemaker;

import junit.framework.TestCase;

	public class InventoryTest extends TestCase {

		private CoffeeMaker cm;
		private Inventory i;
		private Recipe r1;
		
		public void setUp() throws Exception {
			cm = new CoffeeMaker();
			i = cm.checkInventory();

			r1 = new Recipe();
			r1.setName("Recipe 1");
			r1.setPrice(1);
			r1.setAmtCoffee(2);
			r1.setAmtMilk(1);
			r1.setAmtSugar(2);
			r1.setAmtChocolate(1);
		}

		public void tearDown() throws Exception {
			cm = null;
			i = null;
			r1 = null;
		}
		/*
		 * Test getCoffee
		 */

		public void testGetCoffee() {
			assertEquals(15, i.getCoffee());
		}

	//Testing set coffee

		public void testSetCoffee1() {
			i.setCoffee(-20);
			assertEquals(0, i.getCoffee());
		}
		/*
		 * Testing setChocolate to 0
		 */

		public void testSetChocolate1() {
			i.setChocolate(0);
			assertEquals(0, i.getChocolate());
		}

		//Testing setChocolate 

		public void testSetChocolate2() {
			i.setChocolate(-20);
			assertEquals(0, i.getChocolate());
		}
		//Testing setCoffee

		public void testSetCoffee2() {
			i.setCoffee(0);
			assertEquals(0, i.getCoffee());
		}

	//Testing getSugar

		public void testGetSugar() {
			assertEquals(15, i.getSugar());
		}


		public void testSetSugar1() {
			i.setSugar(-15);
			assertEquals(0, i.getSugar());
		}

	
		public void testSetSugar2() {
			i.setSugar(0);
			assertEquals(0, i.getSugar());
		}
		
		 //Testing getMilk


		public void testGetMilk() {
			assertEquals(15, i.getMilk());
		}

		//Testing setMilk

		public void testSetMilk1() {
			i.setMilk(-15);
			assertEquals(0, i.getMilk());
		}
	
		public void testSetMilk2() {
			i.setMilk(0);
			assertEquals(0, i.getMilk());
		}

	
		public void testEnoughIngredients_Coffee1() {
			r1.setAmtCoffee(150);		
			assertFalse(i.enoughIngredients(r1));
		}
		
		//Testing enough ingredients
		public void testEnoughIngredients_Coffee2() {
			r1.setAmtCoffee(1);		
			assertTrue(i.enoughIngredients(r1));
		}
		public void testEnoughIngredients_Sugar1() {
			r1.setAmtSugar(150);
			assertFalse(i.enoughIngredients(r1));
		}
		public void testEnoughIngredients_Sugar2() {
			r1.setAmtSugar(2);
			assertTrue(i.enoughIngredients(r1));
		}

		public void testEnoughIngredients_Milk1() {
			r1.setAmtMilk(150);
			assertFalse(i.enoughIngredients(r1));
		}

		public void testEnoughIngredients_Milk2() {
			r1.setAmtMilk(1);
			assertTrue(i.enoughIngredients(r1));
		}

		public void testEnoughIngredients_Chocolate1() {
			r1.setAmtChocolate(150);
			assertFalse(i.enoughIngredients(r1));
		}

		public void testEnoughIngredients_Chocolate2() {
			r1.setAmtChocolate(2);
			assertTrue(i.enoughIngredients(r1));
		}
		public void testInventory() {
			assertEquals("Coffee: 15\n" + "Milk: 15\n" + "Sugar: 15\n" + "Chocolate: 15\n", i.toString());
		}



	}

